<?php
/**
* Skin file for skin My Skin.
*
* @file
* @ingroup Skins
*/

/**
 * SkinTemplate class for My Skin skin
 * @ingroup Skins
 */
class SkinPhoenix2 extends SkinTemplate {

	var $skinname = 'phoenix2', $stylename = 'phoenix2',
		$template = 'Phoenix2Template', $useHeadElement = true;

	/**
	 * @param $out OutputPage object
	 */
	function setupSkinUserCss( OutputPage $out ){
		parent::setupSkinUserCss( $out );
		$out->addModuleStyles( "skins.phoenix2" );
	}
}

/**
 * BaseTemplate class for My Skin skin
 * @ingroup Skins
 */
class Phoenix2Template extends BaseTemplate {
	/**
	 * Outputs the entire contents of the page
	 */
	public function execute() {
		// Suppress warnings to prevent notices about missing indexes in $this->data
		wfSuppressWarnings();
		$this->html( 'headelement' ); 			
?>



<div id="page">
<div id="masthead"><?php $this->html('title') ?></div>
<div id="navigation">
    <ul id="personal-navigation">
		<?php
        foreach($this->getPersonalTools() as $key => $item) {
        echo $this->makeListItem($key, $item);
        } 
        ?>
    </ul>
    <?php
    foreach ( $this->getSidebar() as $boxName => $box ) { ?>
        <?php
        if ( is_array( $box['content'] ) ) { ?>
    <ul id="primary-navigation">
		<?php
        foreach ( $box['content'] as $key => $item ) { ?>
        <?php echo $this->makeListItem( $key, $item ); ?>
        <?php
        } ?>
    </ul>
      <?php
        } else { ?>

      <?php echo $box['content']; ?>
 
      <?php
        } ?>
      <?php
    } ?>   
    <ul id="secondary-navigation"> 
		<?php $this->cactions(); ?>
    </ul>
</div>
<!-- /personal portlet-->
    

    
    
    
<div id="main">
<div id="content" class="normal">   
    <?php $this->html( 'bodytext' ) ?>
    <?php if($this->data['catlinks']) { $this->html('catlinks'); } ?>
    <?php $this->html ('dataAfterContent') ?>
  

  <!-- mw_portlets -->
</div><!-- main -->
<!-- footer -->
<div id="footer"<?php $this->html('userlangattributes') ?>>
    <?php
		foreach( $this->getFooterLinks("flat") as $aLink ) {
			if( isset( $this->data[$aLink] ) && $this->data[$aLink] ) { ?>
    <div id="<?php echo$aLink?>">
      <?php $this->html($aLink) ?>
    </div>
    <?php 		}} ?>
</div>
<!-- /footer -->


<?php $this->printTrail(); ?>
</body>
</html>
<?php
	}

	/**
	 * Prints the cactions bar.
	 * Shared between MonoBook and Modern
	 */
	function cactions() {
?>

      <?php
				foreach($this->data['content_actions'] as $key => $tab) {
					$linkAttribs = array( 'href' => $tab['href'] );

				 	if( isset( $tab["tooltiponly"] ) && $tab["tooltiponly"] ) {
						$title = Linker::titleAttrib( "ca-$key" );
						if ( $title !== false ) {
							$linkAttribs['title'] = $title;
						}
				 	} else {
						$linkAttribs += Linker::tooltipAndAccesskeyAttribs( "ca-$key" );
				 	}
				 	$linkHtml = Html::element( 'a', $linkAttribs, $tab['text'] );

				 	/* Surround with a <li> */
				 	$liAttribs = array( 'id' => Sanitizer::escapeId( "ca-$key" ) );
					if( $tab['class'] ) {
						$liAttribs['class'] = $tab['class'];
					}
				 	echo '
				' . Html::rawElement( 'li', $liAttribs, $linkHtml );
				} ?>

<?php
		wfRestoreWarnings();
	}
}?>
